﻿using System;
using System.Net;
using caedisi.Models;
using System.Linq;
using caedisi.Helpers;

namespace caedisi.Web.DataModel
{
    /// <summary>
    /// The cellular automata class
    /// </summary>
    public partial class CellularAutomata
    {
        /// <summary>
        /// Gets or sets the cellular automata as array.
        /// </summary>
        /// <value>
        /// The cellular automata as array.
        /// </value>
        public Cell[,,] CellularAutomataAsArray { get; set; }

        /// <summary>
        /// Gets or sets the current simulation.
        /// </summary>
        /// <value>
        /// The current simulation.
        /// </value>
        public Simulation CurrentSimulation { get; set; }


        /// <summary>
        /// Called when [radius visibility changed].
        /// </summary>
        partial void OnRadiusVisibilityChanged()
        {
            //ValidateContaminationAndVisibilityRestriction();
        }

        /// <summary>
        /// Called when [radius contamination changed].
        /// </summary>
        partial void OnRadiusContaminationChanged()
        {
            //ValidateContaminationAndVisibilityRestriction();
        }


        /// <summary>
        /// Validates the contamination and visibility restriction.
        /// </summary>
        public void ValidateContaminationAndVisibilityRestriction()
        {
            if (this.RadiusVisibility < this.RadiusContamination)
                this.RadiusVisibility = this.RadiusContamination;
        }

        partial void OnCreated()
        {
            ;
        }

        public CellularAutomata Clone()
        {
            throw new NotImplementedException();
        }
    }
}
